import { http } from '@/utils/http'

/** 查询字典数据列表 */
export const listData = (params?: object) => {
  return http.request<HttpPaginationResponse<Array<any>>>('get', '/system/dict/data/list', {
    params,
  })
}
/** 查询字典数据列表 */
export const listDataAll = (params?: object) => {
  return http.request<HttpPaginationResponse<Array<any>>>('get', '/system/dict/type/optionselect', {
    params,
  })
}
/** 根据类型数组查询字典数据列表 */
export const listDataAllInfo = () => {
  return http.request<HttpPaginationResponse<Array<any>>>('get', '/system/dict/data/all')
}
/** 查询字典数据详细 */
export const getData = (dictCode: number) => {
  return http.request<HttpResponse<Object>>('get', '/system/dict/data/' + dictCode)
}

/** 根据字典类型查询字典数据信息 */
export const getDicts = (dictType: string) => {
  return http.request<HttpResponse<Array<any>>>('get', '/system/dict/data/type/' + dictType)
}

/** 新增字典数据 */
export const addData = (data?: object) => {
  return http.request<HttpResponse<Object>>('post', '/system/dict/data', {
    data,
  })
}

/** 修改字典数据 */
export const updateData = (data?: object) => {
  return http.request<HttpResponse<Object>>('put', '/system/dict/data', {
    data,
  })
}

/** 删除字典数据 */
export const delData = (dictCode) => {
  return http.request<HttpResponse<Object>>('delete', '/system/dict/data/' + dictCode)
}
